package com.zfast.yugioh.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zfast.forge.common.BaseService;
import com.zfast.forge.common.Page;
import com.zfast.yugioh.model.Card;
import com.zfast.yugioh.model.UserCard;
import com.zfast.yugioh.mapper.UserCardMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * 用户卡集
 *
 * @author zgn
 * @email 
 * @date 2022-06-09 10:10:33
 */
@Service("userCardService")
public class UserCardService extends BaseService<Integer, UserCard> {
    public UserCardService(UserCardMapper mapper) {
        super(mapper);
    }

    @Resource
    UserCardMapper userCardMapper;

    public PageInfo<UserCard> pageList(Page<UserCard> page) {
        PageHelper.startPage(page.getNum(), page.getSize());
        List<UserCard> list = userCardMapper.selectLikeUserCard(page.getData());
        PageInfo<UserCard> pageInfo = new PageInfo(list);
        return pageInfo;
    }

    public List<Card> findCardsByUserId(String userId) {
        return userCardMapper.findCardsByUserId(userId);
    }
}

